package com.owc.service.impl;

import com.owc.common.enums.FileTypeEnum;
import com.owc.common.oss.OssUtils;
import com.owc.domain.entity.OssResult;
import com.owc.service.UploadService;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.fileupload.FileUploadException;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Author xiaom
 * @Date 2020/3/2 16:11
 * @Version 1.0.0
 * @Description <>
 **/
@Service
@Slf4j
public class UploadServiceImpl implements UploadService {

    @Override
    public OssResult uploadImage(String filePath) throws FileUploadException {
        return OssUtils.getInstance().uploadToImage(filePath,false);
    }

    @Override
    public OssResult upload(MultipartFile file, FileTypeEnum fileType) throws IOException, FileUploadException {
        return OssUtils.getInstance().upload(file,false,fileType);
    }

}
